function getCookie(targetKey) {
    var cookies = document.cookie
    if(!cookies) {
        return
    }
    cookies = cookies.split('; ')
    for(var a = 0; a < cookies.length; a++) {
        var [key, value] = cookies[a].split('=')
        if(targetKey === key) {
            return value
        }
    }
}

function setCookie(key, value, seconds, path = '/') {
    var date = new Date()
    date.setTime(date.getTime() - 8 * 3600 * 1000 + seconds * 1000)
    document.cookie = `${key}=${value};expires=${date};path=${path}`
}

function removeCookie(key, path = '/') {
    setCookie(key, null, -1, path)
}